import { App } from 'vue';
import { withInstall } from '@ibiz-template/vue3-util';
import { registerPanelItemProvider } from '@ibiz-template/runtime';
import { PanelDraggableContainer } from './panel-draggable-container';
import { PanelDraggableContainerProvider } from './panel-draggable-container.provider';

const IBizPanelDraggableContainer = withInstall(
  PanelDraggableContainer,
  function (v: App) {
    v.component(PanelDraggableContainer.name!, PanelDraggableContainer);
    registerPanelItemProvider(
      'CUSTOM_PANEL_DRAGGABLE_CONTAINER',
      () => new PanelDraggableContainerProvider(),
    );
  },
);

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: App) {
    app.use(IBizPanelDraggableContainer);
  },
};
